package com.ylw.uibasic;

import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;

/**
 * Tutorial 8: Web View
 *
 */
public class WebActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_web);
		
		Button webButton = (Button)this.findViewById(R.id.web_button);
		webButton.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// Goto a browser
				Intent goWeb = new Intent(Intent.ACTION_VIEW,
						Uri.parse("http://www.google.com"));
				startActivity(goWeb);
			}
		});
		
		WebView webView = (WebView)this.findViewById(R.id.webView);
		webView.loadUrl("http://www.google.com");
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.location, menu);
		return true;
	}

}
